<?php

namespace Action\Flow\GenericFlow\Item;

class Delete extends \Library\Action\UserAction
	implements \Library\Action\AjaxAction {

	private $_item;

	public function execute() {
		parent::execute();
		
		$item_id = $this->getParam( 'id' );
		$this->_item = \Bean\Flow\GenericFlow\Item::get( $item_id );

		_a( $this->_item->isDeletable(), 'You can\'t delete this item' );

		$this->_item->delete();

		return true;
	}
}
